<!-- 基本信息 -->

<template>
  <div>
    <EasyRow col2>
      <FormInput :label="`${MAP.WORD}单号`" bind="changeCode" disabled />
      <FormDate :label="`${MAP.WORD}时间`" bind="changeTime" string future required />
    </EasyRow>

    <EasyRow col2>
      <FormTree
        :label="`调出${CORE.MAP.ORGAN}`"
        bind="deptId, deptName"
        :dict="CORE.ORGAN.DICT"
        required
        @change="changeOrganOut"
      />
      <FormSelect :label="`${MAP.WORD}人`" bind="userId, userName, userPhone" :dict="user_selectDict" required />
    </EasyRow>

    <EasyRow col2>
      <FormTree
        :label="`调入${CORE.MAP.ORGAN}`"
        bind="allocationDeptId, allocationDeptName"
        :dict="CORE.ORGAN.DICT"
        required
        @change="changeOrganIn"
      />
      <FormSelect label="签收人" bind="signUserId, signUserName, signUserPhone" :dict="signer_selectDict" required />
    </EasyRow>

    <FormTextarea label="备注" bind="remark" :max="100" :rows="2" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyBase',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [
    CORE.mixWeb(),
    CORE.mixWeb('device', 'device_'),
    CORE.mixSelect('user', 'user_'),
    CORE.mixSelect('signer', 'signer_'),
  ],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 切换调出部门
     */
    changeOrganOut([id]) {
      this.user_selectParam.organId = id ? [id] : []
      this.user_startSelect()

      this.device_param.organizationId = id
      this.one.assetList = []
    },

    /**
     * 切换调入部门
     */
    changeOrganIn([id]) {
      this.signer_selectParam.organId = id ? [id] : []
      this.signer_startSelect()
    },
  },
}
</script>
